#ifndef Tui_TRocker_h
#define Tui_TRocker_h

#include "TMaskPanel.h"

class TRocker:public TPanel{ 
public:
    static TRocker* create(xml_node<> * pItem);
    virtual  void initWidthConf(xml_node<> * pItem);
    
    CREATE_FUNC(TRocker);
    TRocker(); 
    CCPoint getDirection();
    virtual void onCreateComplete();
    
    virtual void onEnter();
    virtual void onExit();
    
    
    virtual void registerWithTouchDispatcher();
    virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
    virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent);
    virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent);
    
protected:
    CCPoint centerPoint;//摇杆中心
    CCPoint currentPoint;//摇杆当前位置
    
     
    float m_nRadius;//摇杆半径
    
    CCSprite *m_pRockerBg;
    CCSprite *m_pPosNormal;
    CCSprite *m_pPosDown;
    
    
    float getVelocity();
    void  updatePos(float dt);
    
    string normalImagePath;
    string downImagePath;
};


#endif
